package com.kabigon.tiny.event;

import com.alibaba.fastjson.JSON;
import com.kabigon.tiny.domain.User;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;

/**
 * @author xu.biao
 * @version v1.0
 * @Package com.kabigon.tiny.event
 * @data 2023/4/19 23:58
 */
@Slf4j
@Component
public class UserRegisterEventListener implements ApplicationListener<UserRegisterEvent> {
    @Override
    public void onApplicationEvent(UserRegisterEvent userRegisterEvent) {
        Object source = userRegisterEvent.getSource();
        User user = userRegisterEvent.getUser();
        // 获取 用户注册信息
        String userStr = JSON.toJSONString(user, true);
        log.info(userStr);
    }
}
